'use client'
import React from 'react'
import { hydrateStore, useStore } from '@/store'
import Login from '@/app/components/Login'

export default function Index({ children, data, isMobile, myResumes }) {
  useStore.setState({ isMobile, myResumes })
  if (data?.code === 200) {
    hydrateStore(data.data)
  }
  else
    if (data?.code === 401) {
      return <Login needReload={true}></Login>
    }
  if (!data) {
    hydrateStore(null)
  }

  return <div>{children}</div>
}
